package com.yanjingzheng.entity;

/**
 * @Author Yenchingcheng
 * @Date 2023/11/2 17:28
 * @Description 计算机实体类
 **/
public class Computer implements ComputerPart{

    ComputerPart[] parts;

    public Computer(){
        parts = new ComputerPart[]{new Keyboard(),new Mouse(),new Minitor()};
    }

    @Override
    public void accept(ComputerPartVistor computerPartVistor) {
        for (ComputerPart computerPart :parts) {
            computerPart.accept(computerPartVistor);
        }
        computerPartVistor.visit(this);
    }
}
